﻿﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>

<html lang="zh-CN">

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="utf-8">
    <title>在线登录</title>
    <link href="/css/snow.css" rel="stylesheet" type="text/css" media="all"/>
    <link rel="stylesheet" href="css/style1.css">
    <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
    <style type="text/css">
        a {
            text-decoration: none;
        }

        a:hover {
            color: red;
        }
    </style>

</head>

<body>
<%--雪花--%>
<div class="snow-container">
    <div class="snow foreground"></div>
    <div class="snow foreground layered"></div>
    <div class="snow middleground"></div>
    <div class="snow middleground layered"></div>
    <div class="snow background"></div>
    <div class="snow background layered"></div>
</div>
<div>

    <div class="dwo">

        <div class="panda">

            <div class="ear"></div>
            <div class="face">
                <div class="eye-shade"></div>
                <div class="eye-white">
                    <div class="eye-ball"></div>
                </div>
                <div class="eye-shade rgt"></div>
                <div class="eye-white rgt">
                    <div class="eye-ball"></div>
                </div>
                <div class="nose"></div>
                <div class="mouth"></div>
            </div>
            <div class="body"></div>
            <div class="foot">
                <div class="finger"></div>
            </div>
            <div class="foot rgt">
                <div class="finger"></div>
            </div>
        </div>
        <form>

            <%--<a href="index.jsp" >返回</a>--%>
            <div class="hand"></div>
            <div class="hand rgt"></div>
            <h1>用户登录</h1>
            <div class="form-group">
                <input id="username" required="required" class="form-control" name="userName"
                       value="${sessionScope.userName}"
                       style="width: 100%">
                <label class="form-label">请输入用户名</label>
            </div>
            <div class="form-group">
			<span>
                <input id="password" type="password" required="required" class="form-control" name="userpassword"
                       style="width: 200px">
                <label class="form-label">密码</label>
               <a href="page/zhuce/returnPassword.jsp">你忘记密码了？</a>
            </span>

                <p class="alert" id="errorMsg"></p>
                <a href="index.jsp" ><button type="button" class="btn btn-lg btn-danger" style="width: 50px">返回</button></a>
                <button class="btn" id="sub_btn" onclick="return false;" style="width: 50px">登 录</button>
            </div>
            <%--<p ><a href="page/zhuce/returnPassword.jsp">你忘记密码了？</a></p>--%>
            <a  href="page/zhuce/signin.jsp">还没注册，请先去注册</a>
        </form>
    </div>

    <script src="js/jquery-1.11.1.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/script.js"></script>
    <script type="text/javascript">
        $(function () {
            $("#sub_btn").click(function () {
                /*$.ajax({
                    type:'post',

                    url:'http://localhost:8082/user.do?action=login',
                    data:{'userName':$('#username').val(),
                        'userpassword':$("#password").val()
                    },
                    dataType:'json',
                    success:function (data) {




                    }

                })*/
                $.ajax({
                    type: "post",
                    url: "http://localhost:8082/user.do?action=login",
                    data: {
                        'userName': $('#username').val(),
                        'userpassword': $("#password").val()
                    },
                    dataType: 'json',
                    success: function (data) {
                        console.log(data.msg)
                        if (data.msg=='successed') {
                            // location.href="http://localhost:8082/page/LoginSuccessful/login_success.jsp"
                            location.href="/index.jsp"
                        } else {
                            $("#errorMsg").text(data.msg)
                        }


                    }
                })
            });
        })

    </script>
</div>
</body>
</html>